Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ESDB-159-3] Add support for checking Entitlements #48

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

timothycoleman
Copy link
Contributor

@timothycoleman timothycoleman commented Jul 24, 2024

Also do not expect to find a License in the DI. Putting the license in the DI involved doing some sync over async and also meant that the licence couldn't change later (say, if it became in valid).

Instead we now find a ILicenseService in the DI which provides us with the current license and an observable of license updates. Also provides a method for the plugins to reject a license if it doesn't have sufficient entitlements

@timothycoleman timothycoleman changed the title Add support for checking Entitlements [ESDB-159-3] Add support for checking Entitlements Jul 24, 2024
@timothycoleman timothycoleman force-pushed the timothycoleman/check-entitlements branch 2 times, most recently from 862fc5b to 87fa591 Compare July 24, 2024 21:48
@timothycoleman timothycoleman requested a review from shaan1337 July 25, 2024 05:42
Also do not expect to find a License in the DI. Putting the license in the DI involved doing some sync over async and also meant that the licence couldn't change later (say, if it expired).

Instead we now find a ILicenseService in the DI which provides us with the current license and an observable of license updates. Also provides a method for the plugins to reject a license if it doesn't have sufficient entitlements
@timothycoleman timothycoleman force-pushed the timothycoleman/check-entitlements branch from 87fa591 to e759f25 Compare July 25, 2024 05:48
public bool HasEntitlements(string[] entitlements, [MaybeNullWhen(true)] out string missing) {
foreach (var entitlement in entitlements) {
if (!HasEntitlement(entitlement)) {
missing = entitlement;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary for the preview release since there is only one entitlement, but it might be more user-friendly to return all of the missing entitlements rather than just the first one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah fair comment, lets consider that in the future especially if it turns out that some plugins have multiple required entitlements

@timothycoleman timothycoleman merged commit 1babdd5 into master Jul 25, 2024
2 checks passed
@timothycoleman timothycoleman deleted the timothycoleman/check-entitlements branch July 25, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants